home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 2
/
Merciful - Disc 2.iso
/
software
/
m
/
maxonc++3.dms
/
maxonc++3.adf
/
Libs
/
MODULA2
/
FileReq.mod
< prev
next >
Wrap
Text File
|
1992-01-05
|
2KB
|
91 lines
(*---------------------------------------------------------------------------
:Program. FileReq.mod
:Author. Philip Losch
:Address.
:Phone.
:Shortcut.
:Version. 1.1
:Date. 12/1991
:Copyright. Maxon Computer GmbH
:Language. Modula-II
:Translator. M2Amiga V4.0d
:Imports. Standard-Modulen, RCT.library, RctL, RctD
:UpDate. 1.0 Orginal von RCT V1.5
:UpDate. 1.1 M2 V4.0 angepasst [Thomas Nolte]
:Contents. FileRequester Modul
---------------------------------------------------------------------------*)
(* $S- $F- $N- $R- $V- *)
IMPLEMENTATION MODULE FileReq;
FROM SYSTEM IMPORT ADR,ADDRESS;
FROM RCT IMPORT FileReq,FileReqFlags,FileReqFlagSet,RCTFileRequester,
DSIZE,FSIZE,WILDLENGTH,Alert;
FROM Str IMPORT Length,Copy,Concat,LastPos;
FROM IntuitionL IMPORT ScreenToFront;
FROM IntuitionD IMPORT WindowPtr,IDCMPFlagSet, IntuiTextLength,ScreenPtr;
FROM ExecL IMPORT AllocMem,FreeMem,CopyMem;
FROM ExecD IMPORT MemReqs,MemReqSet;
VAR
fr : RCTFileRequester;
PROCEDURE FR(VAR FName: ARRAY OF CHAR; text:INTEGER; win:WindowPtr):BOOLEAN;
PROCEDURE GetPath(VAR f,d:ARRAY OF CHAR);
VAR
pos,i:INTEGER;
BEGIN
Copy(d,f);
pos:=LastPos(f,-1,'/');
IF pos<0 THEN
pos:=LastPos(f,-1,':');
END;
IF pos>=0 THEN
INC(pos);
d[pos]:=0C;
FOR i:=pos TO Length(f) DO
f[i-pos]:=f[i]
END;
f[i]:=0C;
ELSE
d[0]:=0C
END;
END GetPath;
VAR
ndir : ARRAY [0..DSIZE] OF CHAR;
nfile : ARRAY [0..FSIZE] OF CHAR;
npath : ARRAY [0..DSIZE+FSIZE+1] OF CHAR;
field : ARRAY [0..24] OF CHAR;
i : INTEGER;
ptr : POINTER TO CARDINAL;
b : BOOLEAN;
BEGIN
Copy(npath,FName);
Copy(nfile,FName);
GetPath(nfile,ndir);
ptr:=ADR(fr);
FOR i:=1 TO SIZE(fr) DIV 2 DO
ptr^:=0; INC(ptr,2);
END;
WITH fr DO
dir:=ADR(ndir); file:=ADR(nfile); path:=ADR(npath);
IF ld THEN
title:=ADR("Laden");
flags:=FileReqFlagSet{absolute,noHalfCache,load};
ELSE
title:=ADR("Speichern");
flags:=FileReqFlagSet{absolute,noHalfCache,save};
END;
END;
b:=FileReq(ADR(fr));
IF b THEN
Copy(FName,npath);
END;
RETURN b;
END FR;
END FileReq.